#include "Boxer.h"
#include "utils.h"
Boxer::Boxer(char * pname,int page, int pweight)
{
    strcpy(name,pname);
    age = page;
    weight = pweight; 
}
void Boxer::intro()
{
    std::cout<<"Hello everyone! I am "<<name<<". and "<< "I am "<<age<<" years old and I am "<<weight<< " kilograms\n";
}
void Boxer::introSlow()
{
    char *  q = new char[128];
    sprintf(q,"Hello everyone! I am %s,%d years old, and %d kg",name,age,weight);
    char * p = q;
    while(*p != '\0')
    {
        std::cout<<*p++<<std::flush;
        //std::cout<<*p++<<'\a'<<std::flush;
        delay(0.1);
    }
    std::cout<<std::endl;
    delete []q;
}
int Boxer::punch()
{
    int choice = rand()%2;
    std::cout<<name<<" punch "<< (choice==0 ? "left":"right" )<<" <---> ";
    return choice;
}
int Boxer::dodge()
{
    int choice = rand()%2;
    std::cout<<name<<" dodge "<< (choice==0 ? "left":"right")<<std::endl;
    return choice;

}
void Boxer::dance()
{
    std::cout<<name<< " win and dancing"<<std::endl;
}
